package com.mldong.validation.unique;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * 唯一性校验注解
 * @author mldong
 * @date 2022-10-23
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER,ElementType.FIELD})
@Constraint(validatedBy = TableUniqueValidatorClass.class)
public @interface TableUniqueValidator {
    Class<? extends BaseMapper> mapperClass(); // mapper类
    String columnName(); // 表字段
    // 是否必填
    boolean required() default false;
    // 提示内容
    String message() default "该字段值需要保证唯一性，请重新检查！";
    Class<?>[] groups() default {};
    Class<? extends Payload>[] payload() default {};
}
